home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mac Magazin/MacEasy 2
/
Mac Magazin and MacEasy Magazine CD - Issue 02.iso
/
Sharewarebibliothek
/
Applikationen
/
Alpha.5.81 folder
/
xtcls
/
example1.c
< prev
next >
Wrap
C/C++ Source or Header
|
1994-07-28
|
820b
|
44 lines
#include "xtcl.h"
/*
* Simple XTCL. Merely concatenates its arguments, separated by spaces.
* To run, use the Tcl shell to cd to the 'xtcls' direcotry and type
* "xtclcmd -f :concat Concat one two three"
*/
void
main(argc, argv, xpb)
long argc;
char **argv;
XTCLParmBlk *xpb;
{
char *ptr, state;
long i, length, slen;
xpb->result = TCL_OK;
length = GetHandleSize(xpb->resultH);
for (i = 1, slen = 0; i < argc; i++)
{
slen += strlen(argv[i]) + 1;
}
slen++;
// make power of four for luck's sake
slen += (sizeof(int) - (slen % sizeof(int)));
SetHandleSize(xpb->resultH, (long)slen);
state = HGetState(xpb->resultH);
HLock(xpb->resultH);
for (ptr=*xpb->resultH, i=1; i < argc; i++) {
strcat(ptr, argv[i]);
strcat(ptr, " ");
ptr += strlen(ptr);
}
HSetState(xpb->resultH, state);
}